/*
 * @Description:
 * @Author: zhaolei
 * @Date: 2023-04-18 19:51:34
 */

import request from '@/router/axios';

// 获取文章列表
export function fetchList(params) {
  return request({
    url: '/core/article/page',
    method: 'get',
    params,
  });
}

// 新增文章
export function addObj(data) {
  return request({
    url: `/core/article`,
    method: 'post',
    data,
  });
}

// 通过id查询文章详情
export function getObj(id) {
  return request({
    url: `/core/article/${id}`,
    method: 'get',
  });
}

// 编辑文章
export function editObj(data) {
  return request({
    url: `/core/article`,
    method: 'put',
    data,
  });
}

// 删除文章
export function delObj(id) {
  return request({
    url: `/core/article/${id}`,
    method: 'delete',
  });
}

// 发布文章
export function publishObj(id) {
  return request({
    url: `/core/article/release/${id}`,
    method: 'put',
  });
}

// 屏蔽文章
export function shieldObj(id) {
  return request({
    url: `/core/article/shield/${id}`,
    method: 'put',
  });
}
